<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <style>
        body,
        ul {
            margin: 0;
            padding: 0;
        }

        body {
            width: 1920px;
            height: 1080px;

            box-sizing: border-box;
            border: 2px solid red;
            background-color: rgba(255, 0, 0, 0.1);
            transform-origin: left top;
        }

        ul {
            display: flex;
            flex-direction: row;
            flex-wrap: wrap;
            list-style: none;
            width: 100%;
            height: 100%;
        }

        li {
            width: 33.333%;
            height: 50%;
            box-sizing: border-box;
            border: 3px solid green;
            font-size: 30px;
        }
    </style>
</head>

<body>
    <ul>
        <li>1</li>
        <li>2</li>
        <li>3</li>
        <li>4</li>
        <li>5</li>
        <li>6</li>
    </ul>

    <script>
        window.onload = function () {
            triggerScale();
            window.addEventListener("resize", function () {
                triggerScale();
            });
        };

        function triggerScale() {
            var targetX = 1920;
            var targetY = 1080;

            // 获取html的宽度和高度（不包含滚动条）
            var currentX =
                document.documentElement.clientWidth || document.body.clientWidth;
            // https://developer.mozilla.org/en-US/docs/Web/API/Element/clientWidth
            var currentY =
                document.documentElement.clientHeight || document.body.clientHeight;

            // 1.缩放比例  3840 / 2160 => 2
            var ratio = currentX / targetX;

            var bodyEl = document.querySelector("body");
            // 2.需要修改缩放的原点
            bodyEl.setAttribute("style", `transform:scale(${ratio})`);
        }
    </script>
</body>

</html>